In computer science, a virtual machine (VM) is a portion of software that, when executed on appropriate hardware, creates an environment allowing the virtualization of an actual physical computer system. Each VM may function as a self-contained platform, running its own operating system (OS) and software applications (processes). Typically, a virtual machine monitor (VMM) manages allocation and virtualization of computer resources and performs context switching, as may be necessary, to cycle between various VMs.
A host machine (e.g., computer or server) is typically enabled to simultaneously run multiple VMs, where each VM may be used by a local or remote client. The host machine allocates a certain amount of the host's resources to each of the VMs. Each VM is then able to use the allocated resources to execute applications, including operating systems known as guest operating systems. The VMM virtualizes the underlying hardware of the host machine or emulates hardware devices, making the use of the VM transparent to the guest operating system or the remote client that uses the VM.
A virtualization system is a dynamic system. A change in load (e.g., set of resources consumed) on a host, or the balance of load on hosts in the system, can occur because VMs are scheduled to start in different points in time in the system or because VMs stop running in different points in time in the system. Even without any change in how VMs are running on each host, the load created by VMs on each host can vary in several metrics causing unbalanced load. Most commonly, the amount of CPU, memory and I/O required by each VM varies as it performs different tasks.
A load balancing algorithm may be used in such a system to try and balance the load on the different hosts in the system, usually by moving VMs from highly-utilized hosts to less-utilized hosts. This process improves the health of the system, as it prevents a disturbance in the level of service provided by hosts to the virtual machines running on them.
Typically, a load balancing algorithm is based on CPU utilization. A simple example of a load balancing algorithm based on CPU utilization follows: If the average CPU load on a host A is above X percent for more than Y minutes, and there is a host B with less than Z percent of CPU utilization in those Y minutes, then VMs can be migrated from host A to host B, thus reducing the CPU load on host A by sharing the load with host B.
With advances in virtualization systems, memory optimizations are now possible between multiple VMs. This is because VMs may run an operating system (OS) and processes with the same memory image as other VMs. In such a case, a host process may be used to optimize memory utilization on the host, by referencing identical memory pages from multiple VMs to the same single memory page. This is known as memory sharing. Memory sharing reduces the amount of memory required in the host when running VMs with shared memory.
As such, a load balancing algorithm for a virtualization system that takes into account memory considerations, in addition to the other considerations for load balancing, would be beneficial.